/**
 * Copyright (C) 2017-2018 pinganfang, Inc. All Rights Reserved.
 */
package com.pingan.haofang.searchcloud.api;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author huhailiang937
 * @date 2017年5月16日下午2:10:27
 * @since 1.0.0
 */
public class IndexDataResult {

    private List<IndexRowData> result;

    private long totalFound;
    
    private long resultSize;

    private long time;
    
    private Map<String,Object> attribute = new HashMap<String,Object>();
    
    public void setAttribute(String key,Object value){
        if(null == attribute){
            attribute = new HashMap<String,Object>();
        }
        attribute.put(key, value);
    }
    
    @SuppressWarnings("unchecked")
    public <T> T getAttribute(String key){
        if(null == attribute){
            return null;
        }
        return (T) attribute.get(key);
    }

    /**
     * @return the result
     */
    public List<IndexRowData> getResult() {
        return result;
    }

    /**
     * @param result the result to set
     */
    public void setResult(List<IndexRowData> result) {
        this.result = result;
    }


    /**
     * @return the attribute
     */
    public Map<String, Object> getAttribute() {
        return attribute;
    }

    /**
     * @param attribute the attribute to set
     */
    public void setAttribute(Map<String, Object> attribute) {
        this.attribute = attribute;
    }

    /**
     * @return the totalFound
     */
    public long getTotalFound() {
        return totalFound;
    }

    /**
     * @param totalFound the totalFound to set
     */
    public void setTotalFound(long totalFound) {
        this.totalFound = totalFound;
    }

    /**
     * @return the resultSize
     */
    public long getResultSize() {
        return resultSize;
    }

    /**
     * @param resultSize the resultSize to set
     */
    public void setResultSize(long resultSize) {
        this.resultSize = resultSize;
    }

    /**
     * @return the time
     */
    public long getTime() {
        return time;
    }

    /**
     * @param time the time to set
     */
    public void setTime(long time) {
        this.time = time;
    }

}
